package com.cyz.common.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cyz.common.bean.User;
import com.cyz.common.mapper.UserMapper;
import com.cyz.common.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author 34928
* @description 针对表【user(用户表)】的数据库操作Service实现
* @createDate 2023-02-22 10:58:38
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
    implements UserService {

    @Autowired
    UserMapper userMapper;

    @Override
    public User getByUsername(String username) {
        //创建筛选器
        LambdaQueryWrapper<User> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        //匹配用户名
        lambdaQueryWrapper.eq(User::getUserName,username);
        //查询数据
        return getOne(lambdaQueryWrapper);
    }
}




